<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0,
		minimum-scale=1.0, maximum-scale=1.0"/>
    <meta charset="UTF-8">
    <title>订货单详情</title>
    <link href="../public/css/style.css" rel="stylesheet">
    <link href="../public/css/common.css" rel="stylesheet">
</head>
<body class="layout_body">
<div class="layout_content graybg"  style="padding-bottom: 0;">
    <header class="demo-header" style="padding-top: 10px;">
        <div class="titleLeft flt">
            <a href="index.html">
                <img src="../public/img/back.png" width="35px" height="33px">
            </a>
        </div>
        <div class="titleRight flt text-center">订单详情</div>
    </header>
    <div class="whitebg more-flow">
        <div class="sizecolor border2">订单号：<?php echo 'HD'.$orderInfo['orderHeader']['ordercode'];?></div>

        <?php if (isset($orderInfo['below']) && !empty($orderInfo['below'])){ ?>
            <?php foreach ($orderInfo['below'] as $key => $below){ $key++; ?>
                <div class="order-flow-detail <?php if ($key== 3){echo 'text-right';}else{echo 'text-center';} ?>  flt <?php echo 'flow-top'.$key;?>">
                    <p class="guige" <?php if ($key == 1){echo 'style="width:115.91px;height: 32px;margin-left: 25px"';} ?>><?php echo $below['time']; ?></p>
                    <p class="product" style="padding: 3px 0 8px 0;"><?php echo $below['node_name']; ?></p>
                </div>
            <?php } ?>
        <?php } ?>
        <div class="clear_both"></div>
        <div class="order-flow">
            <?php if (isset($orderInfo['workflowList']) && !empty($orderInfo['workflowList'])){ ?>
                <?php
                end($orderInfo['workflowList']);
                $key_last = key($orderInfo['workflowList']);
                ?>
                <?php foreach ($orderInfo['workflowList'] as $key => $val){ ?>
                    <?php if($key != $key_last) { ?>
                        <div class="circle"></div>
                        <div class="changxian"></div>
                    <?php }else { ?>
                        <div class="circle" style="background-color: #E9E9E9;"></div>
                    <?php } ?>
                <?php }  ?>
            <?php } ?>
        </div>
        <div class="clear_both"></div>
        <?php if (isset($orderInfo['up']) && !empty($orderInfo['up'])){ ?>
            <?php foreach ($orderInfo['up'] as $key => $up){  $key++; ?>
                <div class="order-flow-detail flt flow-bottom1 <?php if ($key !==1){echo 'text-center';} ?>" <?php if ($key==4){echo 'style="padding-top: 6px;"';} ?> >
                    <p class="product"><?php echo $up['node_name']; ?></p>
                    <p class="guige" style="padding: 5px 0 5px 0;"><?php echo $up['time']; ?></p>
                </div>
            <?php } ?>
        <?php } ?>
    </div>
    <div class="whitebg">
        <div class="sizecolor">客户信息</div>
        <div class="message-detail">
            <p>渠道：<?php if ($orderInfo['orderHeader']['channel_name']){ echo $orderInfo['orderHeader']['channel_name']; }else{ echo '默认渠道';} ?></p>
            <p>客户：<?php if ($orderInfo['orderHeader']['customer_company']){ echo $orderInfo['orderHeader']['customer_company']; }else{ echo '默认客户';} ?></p>
        </div>
    </div>
    <div class="whitebg">
        <div class="sizecolor">物流信息</div>
        <div class="message-detail">
            <p class="padding-adjust2">联系人：<?php if ($orderInfo['orderHeader']['contact']){ echo $orderInfo['orderHeader']['channel_name']; }else{ echo '无';} ?></p>
            <p>联系电话：<?php if ($orderInfo['orderHeader']['tel']){ echo $orderInfo['orderHeader']['tel']; }else{ echo '无';} ?></p>
            <p>联系地址：<?php if ($orderInfo['orderHeader']['delivery_address']){ echo $orderInfo['orderHeader']['delivery_address']; }else{ echo '无';} ?></p>
            <p>下单时间：<?php if ($orderInfo['orderHeader']['insert_time']){ echo $orderInfo['orderHeader']['insert_time']; }else{ echo '无';} ?></p>
            <p>备注信息：<?php if ($orderInfo['orderHeader']['remark']){ echo $orderInfo['orderHeader']['remark']; }else{ echo '无';} ?></p>
        </div>
    </div>
    <div class="whitebg prodetail" order_id = <?php echo $orderInfo['orderHeader']['id']; ?>>
        <div class="sizecolor flt">商品信息</div><div class="frt sizecolor grayarrow" style="padding-top: 3px;">></div>
        <div class="clear_both"></div>
        <div class="ordetail-img">
            <?php if (isset($orderInfo['orderBody'])){ ?>
                <?php foreach ($orderInfo['orderBody'] as $key => $product){ ?>
                    <div class="order-img">
                        <div>
                            <img src="<?php echo $product['img']?>" />
                        </div>
                        <div class="order-img-font">
                            <p class="product"><?php echo $product['product_name'].'x'.$product['amount']; ?></p>
                            <p class="guige"><?php echo $product['mass_packing']; ?></p>
                        </div>
                    </div>
                <?php } ?>
            <?php } ?>
        </div>
    </div>
    <div class="whitebg">
        <div class="sizecolor">支付信息</div>
        <div class="message-detail">
            <p><?php if ($orderInfo['orderHeader']['pay_class_type']){ echo $orderInfo['orderHeader']['pay_class_type']; }else{ echo '无支付';} ?></p>
            <p>开户名称：<?php if (isset($orderInfo['orderHeader']['account'])){ echo $orderInfo['orderHeader']['account']; }else{ echo '无';} ?></p>
            <p>开户银行：<?php if (isset($orderInfo['orderHeader']['bank_name'])){ echo $orderInfo['orderHeader']['bank_name']; }else{ echo '无';} ?></p>
            <p>开户账号：<?php if (isset($orderInfo['orderHeader']['bank_number'])){ echo $orderInfo['orderHeader']['bank_number']; }else{ echo '无';} ?></p>
        </div>
    </div>
    <div class="whitebg">
        <div class="zonge flt">商品总额</div><div class="frt zonge" style=""><strong>￥<?php if ($orderInfo['orderHeader']['price']){ echo $orderInfo['orderHeader']['price']; }else{ echo '0';} ?></strong></div>
        <div class="clear_both"></div>
        <div class="border-two text-right fontsize zhemanjian">
            <p>折扣：￥<?php if ($orderInfo['orderHeader']['discount']){ echo $orderInfo['orderHeader']['discount']; }else{ echo '0';} ?></p>
            <p>运费：￥<?php if ($orderInfo['orderHeader']['delivery_charge']){ echo $orderInfo['orderHeader']['delivery_charge']; }else{ echo '0';} ?></p>
            <p>优惠：￥<?php if ($orderInfo['orderHeader']['coupon']){ echo $orderInfo['orderHeader']['coupon']; }else{ echo '0';} ?></p>
        </div>
        <div class="flt padding-adjust4"><strong>合计</strong></div><div class="frt money-color padding-adjust4"><strong>￥<?php if ($orderInfo['orderHeader']['price']){ echo $orderInfo['orderHeader']['price']; }else{ echo '0';} ?></strong></div>
        <div class="clear_both"></div>
        <?php if (isset($orderInfo['actionList']) && !empty($orderInfo['actionList'])){ ?>
            <div class="padding-adjust4 border1">
                <?php if (!empty($orderInfo['actionList'])){ ?>
                    <?php foreach ($orderInfo['actionList'] as $k => $v) { ?>
                        <a>
                            <div order_id = <?php echo $orderInfo['orderHeader']['id']; ?> class="button-two
                                    <?php if ($v['action'] == 'promptlypay'){
                                            echo 'Corange '.$v['action'];
                                        }else{
                                            echo 'Cgray '.$v['action'];
                                        } ?>"
                                <?php if ($v['action'] == 'promptlypay') echo 'style="border: 1px solid #EF5507;"'; ?> >
                                <?php echo $v['title']; ?>
                            </div>
                        </a>
                    <?php } ?>
                <?php } ?>
            </div>
        <?php } ?>
    </div>

</div>
</body>
<script>
    /*
    *
    */
    $('body').on('click','.prodetail',function (order_id) {
        var order_id = parseInt($(this).attr('order_id'));
        window.location.href ='/orderfrom/productdetail?order_id='+order_id;
    });

    /*
    * 取消订单
    */
    $('body').on('click','.cancel',function (el) {
        var order_id = parseInt($(this).attr('order_id'));
        if (order_id == '' || order_id ==null || order_id ==undefined){
            layer.msg('订单取消错误');return;
        }
        var index = layer.msg('取消中', {icon: 16,shade: 0.01,time:1000000});
        $.ajax({
            url: '/ajax/orderfrom/',
            type: 'post',
            dataType: 'json',
            data: {'ajaxdata': 'cancel','order_id':order_id},
            success: function (response) {
                layer.msg(response.msg);
                layer.close(index);
                window.location.reload();
            },
            beforeSend: function () {
            }
        });
    });
    /*
     * 支付订单
     */
    $('body').on('click','.promptlypay',function () {
        alert(112);
    });
    /*
     * 退款订单
     */
    $('body').on('click','.refund',function (order_id) {
        var order_id = parseInt($(this).attr('order_id'));
        window.location.href ='/orderfrom/returnrequest?order_id='+order_id;
    });
</script>
</html>
